'use strict';
const mongoose = require('mongoose');
const config = require('../config/config.unittest.js')({});

const UserModel = require('../app/model/User')({
  mongoose,
});
const TopicModel = require('../app/model/Topic')({
  mongoose,
});

mongoose.connect(config.mongoose.url, config.mongoose.options, function (err) {
  if (err) {
    console.error('connect to %s error: ', config.mongoose, err.message);
    process.exit(1);
  }
});

async function main() {
  const users = await UserModel.find({sources: ['播客RSS']});
  console.log(users.length);
  // for (const user of users) {
  //   user.rss = user.url;
  //   await user.save();
  // }


  process.exit(0);
}

main();
